#!/usr/bin/env python
# Copyright(c) 2009 GHCM Ltd. All rights reserved.

from mahbo.information.database.utility import mysqlrecord 
from mahbo.lib import DB
from database.template.connecttemplate import connectTemplate

import orngMySQL


class DatabaseInterface(object):
    
    def __init__(self,mainDBname,connectorng = False):
        self.adb            = {}
#        self.RT             = mysqlrecord.dissertationMySQLrecord()
        self.RD             = mysqlrecord.dataAnalysisMySQLrecord(mainDBname)
        if connectorng:
            self.t          = orngMySQL.Connect(DB.database.host    ,
                                                DB.database.user    ,
                                                DB.database.pwd     ,
                                                mainDBname          ,
                                                )
        
    def addConnect(self,dbname):
        self.adb[dbname]    = connectTemplate(dbname)
    
    def Disconnect(self):
        self.RD.DisconnectDB() #connectTemplate method
        
        
        